using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 入库明细
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("PartInD", "入库明细")]
public class PartInD
{
    /// <summary>
    /// 
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 业务号
    /// </summary>
    [SugarColumn(ColumnName = "BillNo", ColumnDescription = "业务号", Length = 50)]
    [Required, MaxLength(50)]
    public string BillNo { get; set; } = string.Empty;

    /// <summary>
    /// 物料编号
    /// </summary>
    [SugarColumn(ColumnName = "PartNo", ColumnDescription = "物料编号", Length = 50)]
    [Required, MaxLength(50)]
    public string PartNo { get; set; } = string.Empty;

    /// <summary>
    /// 入库数量
    /// </summary>
    [SugarColumn(ColumnName = "InNum", ColumnDescription = "入库数量")]
    public decimal InNum { get; set; }

    /// <summary>
    /// 批次号
    /// </summary>
    [SugarColumn(ColumnName = "BatchNumber", ColumnDescription = "批次号", Length = 10)]
    [MaxLength(10)]
    public string? BatchNumber { get; set; }

    /// <summary>
    /// 金额
    /// </summary>
    [SugarColumn(ColumnName = "Amount", ColumnDescription = "金额")]
    public decimal? Amount { get; set; }

    /// <summary>
    /// 入库仓位
    /// </summary>
    [SugarColumn(ColumnName = "Location", ColumnDescription = "入库仓位")]
    public Guid Location { get; set; }

    /// <summary>
    /// 从产线返还
    /// </summary>
    [SugarColumn(ColumnName = "From_Line", ColumnDescription = "从产线返还")]
    public Guid? FromLine { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// From_Line (从产线返还) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(FromLine),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_From_Line { get; set; }

    /// <summary>
    /// Location (入库仓位) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Location),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Location { get; set; }
}